/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.jPanels;

import bancoDeDados.Conexao;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import regraDeNegocio.RNBemPatrimonial;
import view.Inicio;

/**
 *
 * @author Gean
 */
public class CadBem extends javax.swing.JPanel {
   
    /**
     * Creates new form CadBem
     */
    private ArrayList<JTextField> camposTextoObrig;
    JButton fechar;
    JFrame teste;
    JTabbedPane pane;
    Inicio inicio;
    
    public CadBem(JTabbedPane pane, Inicio inicio) {
        initComponents();
          
        this.pane = pane;
        this.inicio = inicio;
        camposTextoObrig = new ArrayList<>();
        
        camposTextoObrig.add(jTextFieldCor);
        camposTextoObrig.add(jTextFieldDescr);
        camposTextoObrig.add(jTextFieldPlaq);
        camposTextoObrig.add(jTextFieldPred);
        camposTextoObrig.add(jTextFieldResp);
        camposTextoObrig.add(jTextFieldSala);
   }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextFieldDescr = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator3 = new javax.swing.JSeparator();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel15 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jButtonConcluir = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jSeparator4 = new javax.swing.JSeparator();
        jLabel1 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jSeparator5 = new javax.swing.JSeparator();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jTextFieldMarca = new javax.swing.JTextField();
        jTextFieldCor = new javax.swing.JTextField();
        jTextFieldNumSerie = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jSeparator6 = new javax.swing.JSeparator();
        jLabel27 = new javax.swing.JLabel();
        jComboBoxFormaIngr = new javax.swing.JComboBox();
        jTextFieldPlaq = new javax.swing.JTextField();
        jTextFieldPred = new javax.swing.JTextField();
        jButtonPesqNF = new javax.swing.JButton();
        jButtonPesqPlaq = new javax.swing.JButton();
        jTextFieldNF = new javax.swing.JTextField();
        jTextFieldSala = new javax.swing.JTextField();
        jButtonPesqPred = new javax.swing.JButton();
        jTextFieldResp = new javax.swing.JTextField();
        jButtonPesqResp = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED, new java.awt.Color(51, 51, 51), null));
        setToolTipText("Formulário de Cadastro de Bem Patrimonial");

        jTextFieldDescr.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldDescr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldDescrActionPerformed(evt);
            }
        });

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel12.setText("Prédio:");

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel13.setText("Sala:");

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel10.setText("Localização");

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel15.setText("Responsável pelo Bem Patrimonial:");

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel14.setText("Responsável");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setText("Plaqueta");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel2.setText("Numero da Plaqueta:");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel5.setText("Descrição:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel6.setText("Marca:");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel7.setText("Número de Série:");

        jButtonConcluir.setText("Concluir");
        jButtonConcluir.setToolTipText("Concluir Cadastro");
        jButtonConcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConcluirActionPerformed(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel8.setText("Cor:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setText("Características");

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel1.setText("Nota Fiscal");

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel11.setText("Forma de ingresso:");

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel16.setText("Nota fiscal:");

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel17.setForeground(new java.awt.Color(255, 0, 0));
        jLabel17.setText("Campos Obrigatórios *");

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel18.setForeground(new java.awt.Color(255, 0, 0));
        jLabel18.setText("*");

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel19.setForeground(new java.awt.Color(255, 0, 0));
        jLabel19.setText("*");

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel21.setForeground(new java.awt.Color(255, 0, 0));
        jLabel21.setText("*");

        jTextFieldMarca.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldMarca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldMarcaActionPerformed(evt);
            }
        });

        jTextFieldCor.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldCor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldCorActionPerformed(evt);
            }
        });

        jTextFieldNumSerie.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldNumSerie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldNumSerieActionPerformed(evt);
            }
        });

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel22.setForeground(new java.awt.Color(255, 0, 0));
        jLabel22.setText("*");

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel24.setForeground(new java.awt.Color(255, 0, 0));
        jLabel24.setText("*");

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel25.setForeground(new java.awt.Color(255, 0, 0));
        jLabel25.setText("*");

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel26.setForeground(new java.awt.Color(255, 0, 0));
        jLabel26.setText("*");

        jLabel27.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        jLabel27.setText("Cadastro de Bem Patrimonial");

        jComboBoxFormaIngr.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Compra", "Doação" }));
        jComboBoxFormaIngr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxFormaIngrActionPerformed(evt);
            }
        });

        jTextFieldPlaq.setEditable(false);
        jTextFieldPlaq.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldPlaq.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPlaqActionPerformed(evt);
            }
        });

        jTextFieldPred.setEditable(false);
        jTextFieldPred.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldPred.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldPredActionPerformed(evt);
            }
        });

        jButtonPesqNF.setIcon(new javax.swing.ImageIcon("C:\\Users\\Gean\\Desktop\\rp-prototipo\\src\\view\\imagens\\lupa.png")); // NOI18N
        jButtonPesqNF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPesqNFActionPerformed(evt);
            }
        });

        jButtonPesqPlaq.setIcon(new javax.swing.ImageIcon("C:\\Users\\Gean\\Desktop\\rp-prototipo\\src\\view\\imagens\\lupa.png")); // NOI18N
        jButtonPesqPlaq.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPesqPlaqActionPerformed(evt);
            }
        });

        jTextFieldNF.setEditable(false);
        jTextFieldNF.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldNF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldNFActionPerformed(evt);
            }
        });

        jTextFieldSala.setEditable(false);
        jTextFieldSala.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldSala.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldSalaActionPerformed(evt);
            }
        });

        jButtonPesqPred.setIcon(new javax.swing.ImageIcon("C:\\Users\\Gean\\Desktop\\rp-prototipo\\src\\view\\imagens\\lupa.png")); // NOI18N
        jButtonPesqPred.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPesqPredActionPerformed(evt);
            }
        });

        jTextFieldResp.setEditable(false);
        jTextFieldResp.setToolTipText("Digite o Nome do Bem Patrimonial");
        jTextFieldResp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldRespActionPerformed(evt);
            }
        });

        jButtonPesqResp.setIcon(new javax.swing.ImageIcon("C:\\Users\\Gean\\Desktop\\rp-prototipo\\src\\view\\imagens\\lupa.png")); // NOI18N
        jButtonPesqResp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonPesqRespActionPerformed(evt);
            }
        });

        jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Gean\\Desktop\\RP_Ultimo\\rp-prototipo\\src\\view\\imagens\\fechar.png")); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTextFieldDescr.setDocument(new LimitarCaracteres(45));
        jTextFieldMarca.setDocument(new LimitarCaracteres(45));
        jTextFieldCor.setDocument(new LimitarCaracteres(45));
        jTextFieldNumSerie.setDocument(new LimitarCaracteres(45));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator1)
            .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING)
            .addComponent(jSeparator3)
            .addComponent(jSeparator4)
            .addComponent(jSeparator5)
            .addComponent(jSeparator6)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jButtonPesqPred, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(jLabel19)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel11)
                                    .addComponent(jLabel16))
                                .addGap(27, 27, 27)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jComboBoxFormaIngr, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jTextFieldNF, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButtonPesqNF, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addComponent(jLabel3)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel21)
                                    .addComponent(jLabel22))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel5)
                                            .addComponent(jLabel8)
                                            .addComponent(jLabel6))
                                        .addGap(59, 59, 59))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                        .addComponent(jLabel7)
                                        .addGap(18, 18, 18)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jTextFieldCor, javax.swing.GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE)
                                    .addComponent(jTextFieldMarca)
                                    .addComponent(jTextFieldNumSerie)
                                    .addComponent(jTextFieldDescr)))
                            .addComponent(jLabel4)
                            .addComponent(jLabel1)
                            .addComponent(jLabel17))
                        .addContainerGap(378, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel15)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldResp, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonPesqResp, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldPlaq, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonPesqPlaq, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel24)
                            .addComponent(jLabel25))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel12)
                            .addComponent(jLabel13))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextFieldPred, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                            .addComponent(jTextFieldSala)))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel14)))
                .addContainerGap(298, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jButtonConcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel27))
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel17)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jTextFieldPlaq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(jLabel18)))
                    .addComponent(jButtonPesqPlaq))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(jLabel19)
                    .addComponent(jComboBoxFormaIngr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel16)
                        .addComponent(jTextFieldNF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButtonPesqNF))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel21)
                    .addComponent(jTextFieldDescr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel22)
                        .addComponent(jTextFieldCor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldMarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldNumSerie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addGap(27, 27, 27)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(jLabel24)
                            .addComponent(jTextFieldPred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel13)
                            .addComponent(jLabel25)
                            .addComponent(jTextFieldSala, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel15)
                                .addComponent(jLabel26)
                                .addComponent(jTextFieldResp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jButtonPesqResp))
                        .addGap(18, 18, 18)
                        .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButtonPesqPred))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonConcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(18, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jTextFieldDescrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldDescrActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldDescrActionPerformed

    private void jTextFieldMarcaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldMarcaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldMarcaActionPerformed

    private void jTextFieldCorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldCorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldCorActionPerformed

    private void jTextFieldNumSerieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldNumSerieActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldNumSerieActionPerformed

    private void jButtonConcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConcluirActionPerformed
      try{
            int cont=0;
             for (int i = 0; i < camposTextoObrig.size(); i++) {
              if(camposTextoObrig.get(i).getText().equals("")){
                cont++;
               }
              }
             if(cont>0){
             JOptionPane.showMessageDialog(this, "TODOS OS CAMPOS OBRIGATÓRIOS DEVEM SER PREENCHIDOS !");
            }else{
                RNBemPatrimonial bem = new RNBemPatrimonial(jTextFieldDescr.getText(), jTextFieldCor.getText(), Integer.parseInt(jTextFieldPlaq.getText()),
                    jTextFieldNF.getText(), Integer.parseInt(jTextFieldResp.getText()), Integer.parseInt(jTextFieldPred.getText()),
                    Integer.parseInt(jTextFieldSala.getText()), jTextFieldMarca.getText(), jTextFieldNumSerie.getText());
            
            bem.insertBDBem(bem);
            
            JOptionPane.showMessageDialog(this, "CADASTRO CONCLUÍDO COM SUCESSO !");
            pane.remove(this);
            inicio.setContadorBem(0);
            }
        
        }catch(SQLException e){
            JOptionPane.showMessageDialog(this, "A PLAQUETA SELECIONADA ESTÁ SENDO USADA POR UM OUTRO BEM CADASTRADO !");
        }
      
    }//GEN-LAST:event_jButtonConcluirActionPerformed

    private void jTextFieldPlaqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPlaqActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldPlaqActionPerformed

    private void jTextFieldPredActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldPredActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldPredActionPerformed

    private void jTextFieldNFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldNFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldNFActionPerformed

    private void jTextFieldSalaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldSalaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldSalaActionPerformed

    private void jTextFieldRespActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldRespActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextFieldRespActionPerformed

    private void jButtonPesqPlaqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesqPlaqActionPerformed
        JDialog novaJanelaPlaq = new JDialog();
        
        SelecionarPlaqueta plaqueta = new SelecionarPlaqueta(this, novaJanelaPlaq);
        plaqueta.setVisible(true);
        plaqueta.setEnabled(true);
        
        novaJanelaPlaq.setContentPane(plaqueta);
        novaJanelaPlaq.setSize(700, 400);
        novaJanelaPlaq.setLocationByPlatform(true);
        novaJanelaPlaq.setLocationRelativeTo(null);
        novaJanelaPlaq.setModal(true);        
        novaJanelaPlaq.setAlwaysOnTop(true);
        novaJanelaPlaq.setVisible(true);
    }//GEN-LAST:event_jButtonPesqPlaqActionPerformed

    private void jButtonPesqNFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesqNFActionPerformed
        JDialog novaJanelaNF = new JDialog();
        
        SelecionarNotaFiscal notaFiscal = new SelecionarNotaFiscal(this, novaJanelaNF);
        notaFiscal.setVisible(true);
        notaFiscal.setEnabled(true);
        
        novaJanelaNF.setContentPane(notaFiscal);
        novaJanelaNF.setSize(700, 400);
        novaJanelaNF.setLocationByPlatform(true);
        novaJanelaNF.setLocationRelativeTo(null);
        novaJanelaNF.setModal(true);        
        novaJanelaNF.setAlwaysOnTop(true);
        novaJanelaNF.setVisible(true);
    }//GEN-LAST:event_jButtonPesqNFActionPerformed

    private void jComboBoxFormaIngrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxFormaIngrActionPerformed
        if(jComboBoxFormaIngr.getSelectedItem().equals("Compra")){
            jButtonPesqNF.setEnabled(true);
        }else{
            jButtonPesqNF.setEnabled(false);
            jTextFieldNF.setText(null);
        }
    }//GEN-LAST:event_jComboBoxFormaIngrActionPerformed

    private void jButtonPesqPredActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesqPredActionPerformed
        JDialog novaJanelaLocal = new JDialog();
        
        SelecionarSala local = new SelecionarSala(this, novaJanelaLocal);
        local.setVisible(true);
        local.setEnabled(true);
        
        novaJanelaLocal.setContentPane(local);
        novaJanelaLocal.setSize(850, 400);
        novaJanelaLocal.setLocationByPlatform(true);
        novaJanelaLocal.setLocationRelativeTo(null);
        novaJanelaLocal.setModal(true);        
        novaJanelaLocal.setAlwaysOnTop(true);
        novaJanelaLocal.setVisible(true);
    }//GEN-LAST:event_jButtonPesqPredActionPerformed

    private void jButtonPesqRespActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesqRespActionPerformed
        JDialog novaJanelaResp = new JDialog();
        
        SelecionarResponsavel resp = new SelecionarResponsavel(this, novaJanelaResp);
        resp.setVisible(true);
        resp.setEnabled(true);
        
        novaJanelaResp.setContentPane(resp);
        novaJanelaResp.setSize(980, 400);
        novaJanelaResp.setLocationByPlatform(true);
        novaJanelaResp.setLocationRelativeTo(null);
        novaJanelaResp.setModal(true);        
        novaJanelaResp.setAlwaysOnTop(true);
        novaJanelaResp.setVisible(true);
    }//GEN-LAST:event_jButtonPesqRespActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        pane.remove(this);
        inicio.setContadorBem(0);           
    }//GEN-LAST:event_jButton1ActionPerformed
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonConcluir;
    private javax.swing.JButton jButtonPesqNF;
    private javax.swing.JButton jButtonPesqPlaq;
    private javax.swing.JButton jButtonPesqPred;
    private javax.swing.JButton jButtonPesqResp;
    private javax.swing.JComboBox jComboBoxFormaIngr;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JSeparator jSeparator6;
    private javax.swing.JTextField jTextFieldCor;
    private javax.swing.JTextField jTextFieldDescr;
    private javax.swing.JTextField jTextFieldMarca;
    private javax.swing.JTextField jTextFieldNF;
    private javax.swing.JTextField jTextFieldNumSerie;
    private javax.swing.JTextField jTextFieldPlaq;
    private javax.swing.JTextField jTextFieldPred;
    private javax.swing.JTextField jTextFieldResp;
    private javax.swing.JTextField jTextFieldSala;
    // End of variables declaration//GEN-END:variables

    public JTextField getJTextFieldPlaq(){
        return jTextFieldPlaq;
    }
    
    public JTextField getJTextFieldPredio(){
        return jTextFieldPred;
    }
    
    public JTextField getJTextFieldSala(){
        return jTextFieldSala;
    }
    
    public JTextField getJTextFieldNField(){
        return jTextFieldNF;
    }
    
    public JTextField getJTextFieldResp(){
        return jTextFieldResp;
    }
    
    public static void main(String[] args) {
        JFrame jf = new JFrame();
        jf.setVisible(true);
        jf.setSize(1024, 768);
        CadBem bem = new CadBem(null, null);
        jf.add(bem);
        jf.setDefaultCloseOperation(EXIT_ON_CLOSE);
        
    }
}
